package ATM;

import Doudizhu.Util2;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Atm extends JFrame {
    private CardLayout cardLayout = new CardLayout(); //卡片
    private Image btnImg = Util2.Util.getImage("/img/ATMbj.jpg");
    private Longin longin = new Longin(this); //登陆
    private Mun mun = new Mun(this); //菜单
    private Save save = new Save(this);   //存
    private Get get = new Get(this);     //取
    private Check check = new Check(this); //查询





    public Atm() {


        this.setContentPane(new JPanel() {  //背景重写
            @Override  //重写背景样式
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                g.drawImage(btnImg, 0, 0, 800, 800, this);
            }
        });


        this.setLayout(new CardLayout()); //卡片布局
        this.add("登陆", longin); //登陆
        this.add("菜单", mun);    //菜单
        this.add("存", save);
        this.add("取", get);
        this.add("查询", check);




        this.setSize(800, 800);


        //设置窗体的文字标题
        this.setTitle("ATM");
        //设置窗体居中
        this.setLocationRelativeTo(null);
        //设置窗口关闭时程序结束
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
        //设置窗体可见
        this.setVisible(true);


    }

    public static void main(String[] args) {
        new Atm();
    }

    public void switchPanel(String name){
        cardLayout.show(this.getContentPane(),name);
    }


}
